/**
 * 
 */
package com.geezdata.cps.ttk.api.controller;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.geezdata.cps.base.annotation.LoggerOut;
import com.geezdata.cps.base.response.BaseResponse;
import com.geezdata.cps.ttk.common.request.QueryTaskDetailRequest;
import com.geezdata.cps.ttk.common.request.QueryTaskListRequest;
import com.geezdata.cps.ttk.common.response.QueryTaskDetailResult;
import com.geezdata.cps.ttk.common.response.QueryTaskListResult;
import com.geezdata.cps.ttk.query.query.TaskService;

/**
 * @author sszheng
 *
 */
@RestController
@RequestMapping(value="/task")
public class TaskController {
	@Autowired
	private TaskService taskService;
	
	@LoggerOut
    @RequestMapping(value = "/detail", method = RequestMethod.POST)
    public BaseResponse<QueryTaskDetailResult> detail(@Valid @RequestBody QueryTaskDetailRequest request) {
		return BaseResponse.success(taskService.getTaskDetail(request));
    }
	
	@LoggerOut
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    public BaseResponse<QueryTaskListResult> list(@Valid @RequestBody QueryTaskListRequest request) {
		return BaseResponse.success(taskService.getTaskList(request));
    }
}
